<?php

namespace App\Http\Requests\recommend;

use App\Http\Requests\Request;

class addRequests extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            "name" => "required",
            "order" => "required|regex:/^\d+$/",
            "des" => "required",
            "pic" => "required|image",
            "status" => "required",
            "d" => "required|regex:/^\d+$/",
            "h" => "required|regex:/^\d+$/",
            "i" => "required|regex:/^\d+$/",
            "s" => "required|regex:/^\d+$/",
        ];
    }

    public function messages() {
        return [
            "name.required" => "版块名不能为空！",
            "order.required" => "序号不能为空！",
            "order.regex" => "排序号请输入正确的数字！",
            "des.required" => "描述不能为空！",
            "pic.required" => "图片上传不能为空！",
            "pic.image" => "请上传正确格式的图片！",
            "status.required" => "请选择是否在主页显示！",
            "d.required" => "天数不能为空！",
            "d.regex" => "请输入正确的天数！",
            "h.required" => "小时数不能为空！",
            "h.regex" => "请输入正确的小时数！",
            "i.required" => "分钟数不能为空！",
            "i.regex" => "请输入正确的分钟数！",
            "s.required" => "秒数不能为空！",
            "s.regex" => "请输入正确的秒数",

        ];
    }
}
